package b4.controller
{
	import b4.model.*;
	import b4.view.*;
	import b4.view.component.pack.PackageDialog;
	
	import org.puremvc.as3.interfaces.ICommand;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	public class ShowPackageCommand extends SimpleCommand implements ICommand
	{
		override public function execute(notification:INotification):void
		{
			var applicationMediator:ApplicationMediator = facade.retrieveMediator(ApplicationMediator.NAME) as ApplicationMediator;
			if (facade.hasMediator(PackageDialogMediator.NAME))
			{
				facade.removeMediator(PackageDialogMediator.NAME);
			}
			else
			{
				var packageDialog:PackageDialog = new PackageDialog(applicationMediator.mainStage);
				facade.registerMediator(new PackageDialogMediator(packageDialog));
			}
		}
	}
}